{% include "admin/inc/html_header.html" %}
<link href="{{ url_for('static', filename='css/admin/login.css') }}" rel="stylesheet">
<div class="login-box">
    <h2>后台管理系统</h2>
    {% for msg in get_flashed_messages() %}
    <p>{{ msg }}</p>
    {% endfor %}
    <form action="{{ url_for('admin.auth_login') }}" method="post" onsubmit="return checkForm();">
        <div class="login-item">
            <i class="icon icon-user"></i>
            <input type="text" autocomplete="off" class="inp un" name="username" id="username" placeholder="请填写登录账号" />
        </div>
        <div class="login-item">
            <i class="icon icon-lock"></i>
            <input type="password" class="inp pwd" name="password" id="password" placeholder="请填写密码" />
        </div>
        <!--<div class="login-item login-check">
            <i class="icon icon-checked"></i>
            <input name="verify" id="verify" type="text" autocomplete="off" class="inp input_verify" onkeyup="this.value=this.value.toUpperCase()" placeholder="请填写验证码"/>
            <img id="verifyImg" src="{{ url_for('admin.auth_verify') }}" border="0" onclick="javascript:fleshVerify()" style=" cursor:pointer">
        </div>-->
        <div class="login-submit">
           <input type="submit" value="登录" class="btn btn-primary" />
        </div>
    </form>
</div>
<script type="text/javascript">

    $(function(){
        if(top !== self){
            top.location.href='{{ url_for('admin.auth_login') }}';
        }
        SetFocus();
        LocationLG();
        $(window).resize(function(){ LocationLG(); });
    });

    function SetFocus()
    {
        var obj = $('#username');
        var username = $.trim(obj.val());
        if (username == ""){ obj.focus(); }
        else{ obj.select(); }
    }

    function fleshVerify()
    {
        var timeNow = new Date().getTime();
        $('#verifyImg').attr('src', '{{ url_for('admin.auth_verify') }}?ts='+timeNow);
    }

    function checkForm()
    {
        var un = $.trim($('#username').val());
        if(un == ""){ redTip('请填写登录账号'); return false; }
        //if( ! isEmail(un) &&  ! isMobile(un)){ redTip('请填写手机号码或Email'); return false; }
        if($.trim($('#password').val()) == ""){ redTip('请输入密码'); return false; }
        //if($.trim($('#verify').val()) == ""){ redTip('请输入验证码'); return false; }
    }

    function LocationLG()
    {
        $('.login-box').css({'margin-top':($(window).height()/2 - 200), 'margin-left':($(window).width()/2 - 175)});
    }
</script>
{% include "admin/inc/html_footer.html" %}
